<!DOCTYPE html>
    <head>
        <meta charset="utf-8">
        <title>猜数字游戏</title>
    </head>
    <script>
        var getNumber=Math.round(Math.random()*100);
        console.log('系统生成==>',getNumber);
        function guess(){
            var number=document.getElementById("number").value;
            console.log('输入的数==>',number);

            if(getNumber>number){
            alert("很遗憾，猜小了");
        }   else if(getNumber<number){
            alert("很遗憾，猜大了");
        }   else if(getNumber==number ){
            alert("恭喜你猜对了，你猜的数字是"+getNumber+"");
            
        }

    }
    </script>
    <body>
        请输入1-100的整数：
        <input type="text" name="number" id="number" autocomplete="false">
        <input type="button" value="提交" onclick="guess()">
        <p>已经猜过的整数：<span id="number()"></span></p>
        <input type='text' id='num' name='tel' onKeyUp="document.getElementById('span').innerHTML = '已输入'+ (this.value.length) +'位';"> <span id="span">已输入 位</span>
        <p id="getNumber"></p>
    </body>
</html>